<?php
// +----------------------------------------------------------------------
// | Author: 发仔 <i@fazi.me> 
// +----------------------------------------------------------------------

namespace app\unit\controller;

use think\Db;
use think\Cache;

class Staff extends Base
{
	protected $id = 'passenger_id';
	protected $table = 'passenger';
	protected $join = ['company cu','cu.company_id = m.company_id','left'];
	protected $joins = [
        ['company cu','cu.company_id = m.company_id','left'],
        ['user u','u.user_id = m.user_id','left']
    ];

	protected $field = 'm.*,u.username';

	public function parseData($data) {
		
		$data['company_id'] = $this->company_id;
		return $data;
		
	}
	
	public function dept() {
		
		$list = Db::name('department')->where('company_id',$this->company_id)->whereNull('delete_time')->column('department_id','name');
		
		return $this->apiout($list);
	}
	
	
	public function setChecker() {
		
		
		$id = input('param.'.$this->id);
		$is_check = input('param.is_check');
		
		$rslt = Db::name($this->table)->where($this->id,$id)->setField('is_check',$is_check);
		
		return $this->res($rslt);
		
	}

}
